<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<div class="easyui-layout" fit="true" id="vsettv">
  <div region="center" style="padding:0px;border:0px">
  <t:datagrid name="vSettVouchersJavaList" checkbox="true" pagination="true" fitColumns="true" title="" sortName="id" actionUrl="vSettVouchersJavaController.do?datagrid" idField="id" fit="true" queryMode="group">
   <t:dgCol title="凭证编号"  field="sysid" hidden="true" queryMode="group"  width="120"></t:dgCol>
   <t:dgCol title="id"  field="id"  hidden="true"  queryMode="group"  width="120"></t:dgCol>
   <t:dgCol title="支付方"  field="paymemname"  query="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="收款方"  field="inmemname"  query="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="凭证类型"  field="vouchertype" query="true" queryMode="single" dictionary="VOUCHERTP"  width="120"></t:dgCol>
   <t:dgCol title="划拨类型"  field="transtype" query="true" queryMode="single" dictionary="TRANSTYPE" width="120"></t:dgCol>
   <t:dgCol title="凭证类型名称"  field="vouchertypename" hidden="true" queryMode="group"  width="120"></t:dgCol>
   <t:dgCol title="划拨类型名称"  field="transtypename" hidden="true" queryMode="group"  width="120"></t:dgCol>
   <t:dgCol title="划拨时间"  field="transtime"  formatter="yyyy-MM-dd"  query="true"  queryMode="group"  width="120"></t:dgCol>
   <t:dgCol title="支付编码"  field="paymembm" hidden="true" queryMode="group"  width="120"></t:dgCol>
   <t:dgCol title="支付银行"  field="paybankid" dictionary="BANKCODE" queryMode="group"  width="120"></t:dgCol>
   <t:dgCol title="支付账号"  field="payaccountno" queryMode="group"  width="120"></t:dgCol>
   <t:dgCol title="收款编码"  field="inmembm" hidden="true" queryMode="group"  width="120"></t:dgCol>
   <t:dgCol title="收款银行"  field="inbankid" dictionary="BANKCODE" queryMode="group"  width="120"></t:dgCol>
   <t:dgCol title="收款账号"  field="inaccountno" queryMode="group"  width="120"></t:dgCol>
   <t:dgCol title="币种"  field="currencyname"  queryMode="group"  width="120"></t:dgCol>
   <t:dgCol title="划拨金额"  field="transamt" query="true" queryMode="group"  width="120"></t:dgCol>
   <t:dgCol title="备注"  field="vouchermemo" hidden="true" queryMode="group"  width="120"></t:dgCol>
   <t:dgCol title="流水号"  field="serialno"  hidden="true" queryMode="group"  width="120"></t:dgCol>
   <t:dgCol title="来源"  field="sourceflag" hidden="true" queryMode="group"  width="120"></t:dgCol>
   <t:dgCol title="交易类型"  field="tradetype" hidden="true" queryMode="group"  width="120"></t:dgCol>
   <t:dgCol title="合同号"  field="contno" hidden="true" queryMode="group"  width="120"></t:dgCol>
   <t:dgCol title="出卖人"  field="cmr"  hidden="true" queryMode="group"  width="120"></t:dgCol>
   <t:dgCol title="买受人"  field="msr" hidden="true" queryMode="group"  width="120"></t:dgCol>
   <t:dgCol title="结算日"  field="flowdate"  hidden="true" queryMode="group"  width="120"></t:dgCol>
 <%--   <t:dgCol title="操作" field="opt" width="100"></t:dgCol>
   <t:dgDelOpt title="删除" url="vSettVouchersJavaController.do?doDel&id={id}" urlclass="ace_button"  urlfont="fa-trash-o"/>
   <t:dgToolBar title="录入" icon="icon-add" url="vSettVouchersJavaController.do?goAdd" funname="add"></t:dgToolBar>
	<t:dgToolBar title="编辑" icon="icon-edit" url="vSettVouchersJavaController.do?goUpdate" funname="update"></t:dgToolBar>
   <t:dgToolBar title="批量删除"  icon="icon-remove" url="vSettVouchersJavaController.do?doBatchDel" funname="deleteALLSelect"></t:dgToolBar> --%>
   <t:dgToolBar title="查看" icon="icon-search" url="vSettVouchersJavaController.do?goUpdate" funname="detail"></t:dgToolBar>
   <t:dgToolBar title="打印" icon="icon-print" url="vSettVouchersJavaController.do?goUpdate" funname="ctest" ></t:dgToolBar>
   <t:dgToolBar title="导出" icon="icon-putout" funname="ExportXls"></t:dgToolBar>
   <t:dgToolBar title="冻结" icon="icon-edit" url="vSettVouchersJavaController.do?goUpdate" funname="other"></t:dgToolBar>

   <%--    <t:dgToolBar title="导入" icon="icon-put" funname="ImportXls"></t:dgToolBar>
      <t:dgToolBar title="模板下载" icon="icon-putout" funname="ExportXlsByT"></t:dgToolBar> --%>
  </t:datagrid>
  </div>
 </div>
 <script type="text/javascript">
 $(document).ready(function(){

	 var opt;

	    $.fn.jqprint = function (options) {
	        opt = $.extend({}, $.fn.jqprint.defaults, options);

	        var $element = (this instanceof jQuery) ? this : $(this);

	        if (opt.operaSupport && $.browser.opera)
	        {
	            var tab = window.open("","jqPrint-preview");
	            tab.document.open();

	            var doc = tab.document;
	        }
	        else
	        {
	            var $iframe = $("<iframe  />");

	            if (!opt.debug) { $iframe.css({ position: "absolute", width: "0px", height: "0px", left: "-600px", top: "-600px" }); }

	            $iframe.appendTo("body");
	            var doc = $iframe[0].contentWindow.document;
	        }

	        if (opt.importCSS)
	        {
	            if ($("link[media=print]").length > 0)
	            {
	                $("link[media=print]").each( function() {
	                    doc.write("<link type='text/css' rel='stylesheet' href='" + $(this).attr("href") + "' media='print' />");
	                });
	            }
	            else
	            {
	                $("link").each( function() {
	                    doc.write("<link type='text/css' rel='stylesheet' href='" + $(this).attr("href") + "' />");
	                });
	            }
	        }

	        if (opt.printContainer) { doc.write($element.outer()); }
	        else { $element.each( function() { doc.write($(this).html()); }); }

	        doc.close();

	        (opt.operaSupport && $.browser.opera ? tab : $iframe[0].contentWindow).focus();
	        setTimeout( function() { (opt.operaSupport && $.browser.opera ? tab : $iframe[0].contentWindow).print(); if (tab) { tab.close(); } }, 1000);
	    }

	    $.fn.jqprint.defaults = {
			debug: false,
			importCSS: true,
			printContainer: true,
			operaSupport: true
		};

	    // Thanks to 9__, found at http://users.livejournal.com/9__/380664.html
	    jQuery.fn.outer = function() {
	      return $($('<div></div>').html(this.clone())).html();
	    }



 });
 function printall(body){
		console.log(body);
		$(body.document.getElementById("cc")).jqprint();
	}

 function ctest(title,url,gridname,width,height){

		var rowData = $('#'+gridname).datagrid('getSelected');
		if (!rowData) {
			tip('请选择审核项目');
			return;
		}
		var title="打印"
		url = url+"&id="+rowData['id'];
		width = width ? width : 700;
		height = height ? height : 400;
		if (width == "100%" || height == "100%") {
			width = window.top.document.body.offsetWidth;
			height = window.top.document.body.offsetHeight - 100;
		}



		 $.dialog({
			content: 'url:'+url,
			lock : true,
			width:width,
			height: height,
			title:title,
			opacity : 0.3,
			cache:false,
		    cancelVal: '关闭',
		    cancel: true, /*为true等价于function(){}*/
		    button:[{				//自定义设置按钮
	            name: '打印',
	            callback: function(){
	                iframe = this.iframe.contentWindow;//获取弹出层的iframe
	                printall(iframe);//自定义保存数据方法
	                return false;//阻止页面关闭（默认为true不关闭）
	            }
	        }],
		});
	}



//导入
function ImportXls() {
	openuploadwin('Excel导入', 'vSettVouchersJavaController.do?upload', "vSettVouchersJavaList");
}

//导出
function ExportXls() {
	JeecgExcelExport("vSettVouchersJavaController.do?exportXls","vSettVouchersJavaList");
}

//模板下载
function ExportXlsByT() {
	JeecgExcelExport("vSettVouchersJavaController.do?exportXlsByT","vSettVouchersJavaList");
}

 </script>
